package com.itheima.homework.homework2;

public class Demo2 {
    public static void main(String[] args) {
        method(new Dog());
        // 请在此处调用method方法
    }

    public static void method(Animal a){
        a.eat();

        ((Dog)a).watchHome();
    }
}
abstract class Animal {
    public abstract void eat();
}

class Dog extends Animal{

    @Override
    public void eat() {
        System.out.println("狗吃肉");
    }

    public void watchHome(){
        System.out.println("狗看家");
    }
}
